﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UtilityLibrary.Ormapping
{
    [AttributeUsage(AttributeTargets.Property)]
    public sealed class ModelPropertyAttribute : Attribute
    {
        private String _fieldName;
        private Boolean _isPKValue;
        private Boolean _isIndex;
        private Boolean _isComputed;
        public ModelPropertyAttribute(String fieldName)
        {
            _fieldName = fieldName;
        }
        public ModelPropertyAttribute(String fieldName, Boolean isPKValue)
        {
            _fieldName = fieldName;
            _isPKValue = isPKValue;
        }
        public ModelPropertyAttribute(String fieldName, Boolean isPKValue, Boolean isIndex)
        {
            _fieldName = fieldName;
            _isPKValue = isPKValue;
            _isIndex = isIndex;
        }
        public ModelPropertyAttribute(String fieldName, Boolean isPKValue, Boolean isIndex, Boolean isComputed)
        {
            _fieldName = fieldName;
            _isPKValue = isPKValue;
            _isIndex = isIndex;
            _isComputed = isComputed;
        }
        /// <summary>
        /// 字段名称
        /// </summary>
        public String FieldName
        {
            get
            {
                return _fieldName;
            }
        }

        /// <summary>
        /// 是否为主键
        /// </summary>
        public Boolean IsPKValue
        {
            get
            {
                return _isPKValue;
            }
        }

        /// <summary>
        /// 是否为索引（自动增长列）
        /// </summary>
        public Boolean IsIndex
        {
            get
            {
                return _isIndex;
            }
        }
        public Boolean IsComputed
        {
            get
            {
                return _isComputed;

            }
        }
    }
}
